<template>
  <van-notice-bar left-icon="volume-o" :scrollable="false"
  @click="viewDetail(notice[0])"
  :text="notice.length>0?notice[0].post_title:'暂无公告'"
  >
  </van-notice-bar>
</template>

<script>

export default {
  components: {
  },
  data () {
    return {
      notice: []
    }
  },
  created () {
    this.getNotice({ type: 1 })
  },
  methods: {
    getNotice(params){
      var that=this
      this.socketUser.AjaxRequest(this.API.NOTICE_LISTS,
      params, function(res) {
        that.notice = res.data.list
        console.log(that.notice)
      },false)
    },
    viewDetail (item) {
      uni.navigateTo({
        url:`/pages/common/article?params=${JSON.stringify({ url: item.visit_url, title:item.post_title })}`

      })

    }
  }
}
</script>

<style scoped lang="less">
.notice-swipe {
  height: 40px;

  line-height: 40px;
}
/deep/ .van-notice-bar__content {
  width: 100%;
}
</style>
